import requests

if __name__ == '__main__':
    #请求用户注册 get 用params

    #如何指定get传参 定义字典
    user = {"username":"admin","password":"123","email":"861228389@qq.com","phone":120}
    resp = requests.get("http://127.0.0.1:8080/stest/user/regist.action",params =user)
    print(resp.text)

    #用户登录 post    data
    denglu = {"username":"zhangsan","password":123}
    resp = requests.post("http://127.0.0.1:8080/stest/user/login.action",data = denglu)
    print(resp.text)
    # post接口  raw类型  用户注册

    zhuce = requests.post("http://127.0.0.1:8080/stest/user/dataRegist",json=user)
    print(zhuce.text)

    #图片上传接口 form-data

    user1 = {"username":"laozhang"}
    #file =
    file_param={"pic":open("1.jpg",mode="rb")}
    fileResp =requests.post("http://127.0.0.1/stest/user/upload.action",data=user1,files=file_param)
    print(fileResp.text)

